package com.fr.report.write.config;

import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.core.db.dml.Table;
import com.fr.data.core.db.dml.Update;
import com.fr.data.core.db.dml.Where;
import com.fr.report.script.Calculator;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;

public class UpdateConfig extends DMLConfig
{
  public void dmlSubmit(Connection paramConnection, Calculator paramCalculator, Object[] paramArrayOfObject, Map paramMap)
    throws SQLException
  {
    Where localWhere = generateWhere(paramConnection, paramCalculator, paramArrayOfObject);
    if ((localWhere == null) || (this.table == null))
      return;
    int i = getColumnConfigCount();
    if (i == 0)
      return;
    Dialect localDialect = DialectFactory.generateDialect(paramConnection);
    Update localUpdate = new Update(this.table, localWhere, localDialect);
    for (int j = 0; j < i; ++j)
    {
      ColumnConfig localColumnConfig = getColumnConfig(j);
      if (localColumnConfig.isKey())
        break label119:
      String str = localColumnConfig.getColumnName();
      Object localObject = paramArrayOfObject[j];
      int k = getColumnType(str, paramConnection);
      localUpdate.addColumn(str, k, localObject);
    }
    if (!(Update.validate(localUpdate)))
      label119: return;
    localUpdate.execute(paramConnection);
  }

  public String toString()
  {
    return "update " + this.table.toString() + " " + super.toString();
  }
}